//
//  XWHTBHeaderFooterBaseView.swift
//  XiaoweHealthy
//
//  Created by Riven on 2022/3/31.
//

import UIKit

class XWHTBHeaderFooterBaseView: UITableViewHeaderFooterView {
    
    class var titleFont: UIFont {
        AppFont.harmonyOSSans(ofSize: 16, weight: .regular)
    }
    
    lazy var titleLb = UILabel()

    override init(reuseIdentifier: String?) {
        super.init(reuseIdentifier: reuseIdentifier)
        
        addSubViews()
        relayoutSubViews()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    
    func addSubViews() {
        contentView.addSubview(titleLb)

        titleLb.font = Self.titleFont
        titleLb.textColor = minorTextColor
        titleLb.numberOfLines = 0
        titleLb.adjustsFontSizeToFitWidth = false
    }
    
    func relayoutSubViews() {
        relayoutSubViews(leftRight: 16)
    }
    
    func relayoutSubViews(leftRight: CGFloat = 16, topBottom: CGFloat = 0) {
        titleLb.snp.remakeConstraints { make in
            make.top.bottom.equalToSuperview().inset(topBottom)
            make.left.right.equalToSuperview().inset(leftRight).priority(.high)
        }
    }

}
